﻿using Flurl.Http;
using Newtonsoft.Json;
namespace supermarket
{
    internal class HTTPUtils
    {
        public static res jsonPost(String url, object data)
        {
            var Res = ("http://127.0.0.1/"+url).PostJsonAsync(data).Result;
            res res = JsonConvert.DeserializeObject<res>(Res.GetStringAsync().Result);
            return res;
        }
        public static res GET(String url)
        {
            var Res = ("http://127.0.0.1/" + url).GetAsync().Result;
            res res = JsonConvert.DeserializeObject<res>(Res.GetStringAsync().Result);
            return res;
        }
    }
    
    public class res
    {
        public string cod { get; set; }
        public string flag { get; set; }
        public Object date { get; set; }
        public string msg { get; set; }
    }
}
